exports.salesList = (req, res) => {

    var restfulParams = req.routeInfo.restfulParams;

    var resultData = {};

    var u_id = restfulParams.u_id;

    var userInfo = 0;

    var userArr = 0;

    function salesSearch(cb) {
        R.SEND_HTTP(
            req,
            res, {
                url: CORE_APIConfig.coreAPI.userSearch.Request_Api_Url + "/u_id/" + u_id,
                method: 'POST',
                data: {
                    fields: ['u_is_admin', 'u_master_osid'].join(",")
                }
            },
            function (data) {

                userInfo = data.result.data;

                cb();

            }
        )
    }

    function screeningEmployees(cb) {
        if (userInfo[0].u_is_admin < 1) {
            //查询对应节点员工
            R.SEND_HTTP(
                req,
                res, {
                    url: CORE_APIConfig.coreAPI.userSearch.Request_Api_Url + "/u_is_activation/1/u_is_delete/0/u_master_osid/" + userInfo[0].u_master_osid,
                    method: 'POST',
                    data: {
                        fields: ['u_id', 'u_nickname', 'u_phone'].join(",")
                    }
                },
                function (data) {

                    userArr = data.result.data;

                    cb();

                }
            )
        } else {
            //查询所有员工
            R.SEND_HTTP(
                req,
                res, {
                    url: CORE_APIConfig.coreAPI.userSearch.Request_Api_Url + "/u_is_admin/0/u_is_activation/1/u_is_delete/0",
                    method: 'POST',
                    data: {
                        fields: ['u_id', 'u_nickname', 'u_phone'].join(",")
                    }
                },
                function (data) {

                    userArr = data.result.data;

                    cb();

                }
            )
        }

    }

    function outPutUserList(cb){
        resultData.userList = userArr;
        cb()
    }

    F.Serial([
        salesSearch,
        screeningEmployees,
        outPutUserList,
    ], () => {
        RES.successResponse(res, resultData);
    })


}